package org.example;

import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;

import java.util.Arrays;
import java.util.List;
public class hi {
    public static void main (String[] args){
        final JavaSparkContext sc = new JavaSparkContext("local","spark");
        final List<Integer> nums = Arrays.asList(1,2,3,4,5,6,7,8,9,10);
        final JavaRDD<Integer>rdd = sc.parallelize(nums);
        System.out.println(rdd.collect());
        System.out.println(rdd.partitions().size());
        final JavaRDD<String> rddText = sc.textFile("E://text.txt");
        System.out.println(rddText.collect());
        rddText.saveAsTextFile("output");
        sc.close();

    }

}
